//
// Created by whg on 2025-06-02.
//

#ifndef PYVM_2025_BYTE_CODE_HPP
#define PYVM_2025_BYTE_CODE_HPP

class ByteCode{
public:
    static const unsigned char POP_TOP = 1;

    static const unsigned char BINARY_ADD = 23;

    static const unsigned char RETURN_VALUE = 83;

    static const unsigned char HAVE_ARGUMENT = 90; /* Opcodes from here have an argument: */
    // ----------------------------------------------------------------------------------------->

    static const unsigned char STORE_NAME = 90; /* Index in name list */

    static const unsigned char STORE_GLOBAL = 97;

    static const unsigned char LOAD_CONST = 100; /* Index in const list */
    static const unsigned char LOAD_NAME = 101; /* Index in name list */
    static const unsigned char BUILD_TUPLE = 102;
    static const unsigned char LOAD_ATTR = 106; /* Index in name list */
    static const unsigned char COMPARE_OP = 107; /* Comparison operator */
    static const unsigned char JUMP_FORWARD = 110; /* Number of bytes to skip */

    static const unsigned char JUMP_ABSOLUTE = 113;
    static const unsigned char POP_JUMP_IF_FALSE = 114;

    static const unsigned char LOAD_GLOBAL = 116; /* Index in name list */
    static const unsigned char LOAD_FAST = 124; /* Local variable number */
    static const unsigned char STORE_FAST = 125; /* Local variable number */
    static const unsigned char CALL_FUNCTION = 131;
    static const unsigned char MAKE_FUNCTION = 132;

    static const unsigned char LOAD_METHOD = 160;
    static const unsigned char CALL_METHOD = 161;

    enum COMPARE {
        LESS = 0,
        LESS_EQUAL,
        EQUAL,
        NOT_EQUAL,
        GREATER,
        GREATER_EQUAL,
        IN,
        NOT_IN,
        IS,
        IS_NOT,
        EXC_MATCH,
    };
};

#endif //PYVM_2025_BYTE_CODE_HPP
